<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var time = new Date();
      console.log(time.getFullYear());
      console.log(time.getMonth() + 1); //月份 0-11  所以这里+1
      console.log(time.getDate());
      console.log(time.getDay());
      console.log(time.getHours());
      console.log(time.getMinutes());
      console.log(time.getSeconds());
      console.log(time.getTime());
    </script>
  </body>
</html>
